home *** CD-ROM | disk | FTP | other *** search
- {DivFix is a utility for reindexing partial DivX AVI movies
- Copyright (C) 2000-2002 Csaba Budai
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA}
-
- unit DivX;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- StdCtrls, Mask, Menus, ExtCtrls, Buttons, DropSource, DropTarget,
- ComCtrls;
-
- type
- TForm1 = class(TForm)
- Button1: TButton;
- Button2: TButton;
- Button3: TButton;
- MaskEdit1: TMaskEdit;
- OpenDialog1: TOpenDialog;
- MainMenu1: TMainMenu;
- File1: TMenuItem;
- Help1: TMenuItem;
- About1: TMenuItem;
- Open1: TMenuItem;
- Regenerate1: TMenuItem;
- Strip1: TMenuItem;
- Exit1: TMenuItem;
- Panel1: TPanel;
- SpeedButton1: TSpeedButton;
- Memo1: TMemo;
- Window1: TMenuItem;
- Stayontop1: TMenuItem;
- DropFileTarget1: TDropFileTarget;
- ProgressBar1: TProgressBar;
- Check1: TMenuItem;
- Stop: TButton;
- CheckBox1: TCheckBox;
- CheckBox2: TCheckBox;
- procedure SpeedButton1Click(Sender: TObject);
- procedure Button1Click(Sender: TObject);
- procedure Button2Click(Sender: TObject);
- procedure Exit1Click(Sender: TObject);
- procedure About1Click(Sender: TObject);
- procedure StayTop(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- procedure FormDestroy(Sender: TObject);
- procedure DropFileTarget1Drop(Sender: TObject; ShiftState: TShiftState;
- Point: TPoint; var Effect: Integer);
- procedure Button3Click(Sender: TObject);
- procedure StopClick(Sender: TObject);
- procedure CheckBox1Click(Sender: TObject);
-
- private
- { Private declarations }
- public
- Input,Output : File;
- Backup : File;
- i,j : Cardinal;
- Size,Position : Cardinal;
- StreamStart : Cardinal;
- StreamSize : Cardinal;
- Difference : Cardinal;
- Frame : Cardinal;
- Interleaved : Boolean;
- OnTop : Boolean;
- StopButton : Boolean;
- Chunkname : String[8];
- Temp : integer;
- FrameType : Byte;
- Buffer : Array [1..32800] Of Byte;
- Text : String;
- end;
-
- Const
- KeyFrame : Longint = 16;
- NormFrame : Longint = 0;
- Number : Set of char =['0'..'9'];
-
- var
- Form1: TForm1;
-
- implementation
-
- uses About;
-
- {$R *.DFM}
-
- procedure DisableButtons;
- begin
- Form1.MaskEdit1.Enabled:=False;
- Form1.Button1.Enabled:=False;
- Form1.Button2.Enabled:=False;
- Form1.Button3.Enabled:=False;
- Form1.CheckBox1.Enabled:=False;
- Form1.CheckBox2.Enabled:=False;
- end;
-
- procedure EnableButtons;
- begin
- Form1.MaskEdit1.Enabled:=True;
- Form1.Button1.Enabled:=True;
- Form1.Button2.Enabled:=True;
- Form1.Button3.Enabled:=True;
- Form1.CheckBox1.Enabled:=True;
- If Form1.CheckBox1.Checked Then Form1.CheckBox2.Enabled:=True;
- end;
-
- procedure TForm1.SpeedButton1Click(Sender: TObject);
- begin
- If OpenDialog1.Execute Then MaskEdit1.Text:=OpenDialog1.FileName;
- end;
-
- procedure TForm1.Button1Click(Sender: TObject);
- Var k : Cardinal;
- Label BError;
- Label BStartRead;
- begin
- DisableButtons;
- If MaskEdit1.Text='' Then
- Begin
- Memo1.Lines.Insert(0,' No file selected.');
- EnableButtons;
- Exit;
- End;
- AssignFile(Input,MaskEdit1.Text);
- AssignFile(Output,'$TEMP.IDX');
- AssignFile(Backup,MaskEdit1.Text+'.DivFix');
- {$I-}
- Reset(Input,1);
- {$I+}
- Temp:=IOResult;
- If Temp<>0 Then
- Begin
- If (Temp=3) Or (Temp=2) Then Memo1.Lines.Insert(0,' File not found.')
- Else
- If Temp=5 Then Memo1.Lines.Insert(0,' The file is write-protected.')
- Else Memo1.Lines.Insert(0,' Can not open the file.');
- EnableButtons;
- Exit;
- End;
- Seek(Input,8);
- BlockRead(Input,ChunkName[1],8,Temp);
- ChunkName[0]:=#8;
- If ChunkName<>'AVI LIST' Then
- Begin
- Memo1.Lines.Insert(0,' This is not an AVI file.');
- CloseFile(Input);
- EnableButtons;
- Exit;
- End;
- {$I-}
- Rewrite(Output,1);
- {$I+}
- If IOResult<>0 Then
- Begin
- Memo1.Lines.Insert(0,' Cannot create temporary index file.');
- CloseFile(Input);
- EnableButtons;
- Exit;
- End;
- If CheckBox1.Checked Then
- Begin
- AssignFile(Backup,MaskEdit1.Text+'.DivFix');
- {$I-}
- Rewrite(Backup,1);
- {$I+}
- If IOResult<>0 Then
- Begin
- Memo1.Lines.Insert(0,' Cannot create backup file.');
- CloseFile(Input);
- CloseFile(Output);
- If CheckBox1.Checked Then CloseFile(Backup);
- Erase(Output);
- EnableButtons;
- Exit;
- End;
- End;
- Memo1.Lines.Insert(0,' Rebuilding index...');
- Position:=16;
- Size:=0;
- Chunkname[0]:=#4;
- Repeat
- Position:=Position+Size;
- Seek(Input,Position);
- BlockRead(Input,Size,4);
- BlockRead(Input,Chunkname[1],4);
- Inc(Position,8);
- Until Chunkname='movi';
- StreamStart:=Position-4;
- StreamSize:=Size;
- Chunkname:='idx1';
- BlockWrite(Output,Chunkname[1],4);
- BlockWrite(Output,Size,4);
- Position:=4;
- i:=0;
- Frame:=0;
- Difference:=0;
- Interleaved:=False;
- StopButton:=False;
- Seek(Input,0);
- If CheckBox1.Checked Then
- Begin
- BlockRead(Input,Buffer[1],StreamStart+4,Temp);
- BlockWrite(Backup,Buffer[1],Temp);
- End;
- Repeat
- ProgressBar1.Position:=Position Div (FileSize(Input) Div 100);
- Seek(Input,StreamStart+Position);
- If Not Eof(Input) Then
- Begin
- BStartRead:
- BlockRead(Input,Chunkname[1],4,Temp);
- If ChunkName='LIST' Then
- Begin
- Seek(Input,FilePos(Input)+8);
- Inc(Position,12);
- Goto BStartRead;
- End;
- If ChunkName='JUNK' Then
- Begin
- BlockRead(Input,Size,4);
- Position:=Position+Size+8;
- Seek(Input,StreamStart+Position);
- Goto BStartRead;
- End;
- If (Copy(ChunkName,1,2)='ix') Or (Copy(ChunkName,3,2)='ix') Then
- Begin
- Seek(Input,FilePos(Input)+12);
- Inc(Position,16);
- Seek(Input,StreamStart+Position);
- Interleaved:=True;
- Goto BStartRead;
- End;
- If Not Eof(Input) Then
- Begin
- If ((ChunkName[1] In Number) And (ChunkName[2] In Number)) And
- ((Copy(ChunkName,3,2)='dc') Or (Copy(ChunkName,3,2)='db') Or
- (Copy(ChunkName,3,2)='wb')) Then
- Begin
- Inc(Frame);
- If Interleaved Then
- Begin
- Seek(Input,FilePos(Input)-16);
- Dec(Position,16);
- Interleaved:=False;
- End;
- BlockRead(Input,Size,4,Temp);
- If (Size<0) And (Temp=4) Then
- Begin
- Inc(Position,4);
- Seek(Input,StreamStart+Position);
- BlockRead(Input,Chunkname[1],4,Temp);
- If ChunkName='LIST' Then
- Begin
- Seek(Input,FilePos(Input)+8);
- Inc(Position,12);
- Goto BStartRead;
- End;
- If ChunkName='JUNK' Then
- Begin
- BlockRead(Input,Size,4);
- Position:=Position+Size+8;
- Seek(Input,StreamStart+Position);
- Goto BStartRead;
- End;
- Seek(Input,StreamStart+Position);
- Goto BError;
- End;
- If Not Eof(Input) Then
- Begin
- BlockRead(Input,FrameType,1);
- j:=(((Position+Size) Div 2)+((Position+Size) Mod 2))*2+8;
- Seek(Input,StreamStart+j-1);
- If Not Eof(Input) Then
- Begin
- BlockWrite(Output,Chunkname[1],4);
- If ((Copy(ChunkName,3,2)='dc') Or (Copy(ChunkName,3,2)='db') Or
- (Copy(ChunkName,3,2)='wb')) And ((Chunkname[1]In Number) And
- (ChunkName[2] In Number)) And (FrameType And 64=0)
- Then
- BlockWrite(Output,KeyFrame,4)
- Else
- BlockWrite(Output,NormFrame,4);
- If CheckBox2.Checked Then
- Begin
- j:=Position-Difference;
- BlockWrite(Output,j,4)
- End
- Else BlockWrite(Output,Position,4);
- BlockWrite(Output,Size,4);
- j:=Position;
- Position:=(((Position+Size) Div 2)+((Position+Size) Mod 2))*2+8;
- Seek(Input,StreamStart+j);
- If CheckBox1.Checked Then
- Begin
- If Position-j>32768 Then
- Begin
- For k:=1 To (Position-j) Div 32768 Do
- Begin
- BlockRead(Input,Buffer[1],32768,Temp);
- BlockWrite(Backup,Buffer[1],Temp);
- End;
- BlockRead(Input,Buffer[1],((Position-j) Mod 32768),Temp);
- BlockWrite(Backup,Buffer[1],Temp);
- End
- Else
- Begin
- BlockRead(Input,Buffer[1],Position-j,Temp);
- BlockWrite(Backup,Buffer[1],Temp);
- End;
- End;
- Inc(i);
- End;
- End;
- End
- Else
- BError:
- If Chunkname<>'idx1' Then
- Begin
- Str(Frame,Text);
- Text:=' Corrupted data detected at frame '+Text;
- If FilePos(Output)>16 Then Seek(Output,FilePos(Output)-16);
- Memo1.Lines.Insert(0,Text);
- Str(StreamStart+Position,Text);
- Text:=' Error offset: '+Text;
- Memo1.Lines.Insert(0,Text);
- j:=Position;
- Repeat
- Seek(Input,StreamStart+Position);
- If Not Eof(Input) Then
- Begin
- BlockRead(Input,Buffer[1],32768,Temp);
- k:=1;
- Repeat
- If ((Chr(Buffer[k])='d') Or (Chr(Buffer[k])='w')) And (Not Eof(Input)) Then
- Begin
- If ((Chr(Buffer[k+1])='c') Or (Chr(Buffer[k+1])='b')) And (Not Eof(Input)) Then
- Begin
- Seek(Input,StreamStart+Position+k-3);
- If Not Eof(Input) Then BlockRead(Input,ChunkName[1],4);
- End;
- End;
- Inc(k);
- Until (((Copy(ChunkName,3,2)='dc') Or (Copy(ChunkName,3,2)='db') Or
- (Copy(ChunkName,3,2)='wb')) And ((ChunkName[1] In Number) And
- (ChunkName[2] In Number))) Or (Chunkname='idx1') Or (k>32768);
- End;
- Inc(Position,k-3);
- Application.ProcessMessages;
- If StopButton Then
- Begin
- Memo1.Lines.Insert(0,' Index rebuilding aborted...');
- ProgressBar1.Position:=0;
- StopButton:=False;
- CloseFile(Input);
- CloseFile(Output);
- If CheckBox1.Checked Then CloseFile(Backup);
- Erase(Output);
- EnableButtons;
- Exit;
- End;
- Until (((Copy(ChunkName,3,2)='dc') Or (Copy(ChunkName,3,2)='db') Or
- (Copy(ChunkName,3,2)='wb')) And ((ChunkName[1] In Number) And
- (ChunkName[2] In Number))) Or (Chunkname='idx1') Or Eof(Input);
- If Not Eof(Input) Then Dec(Position);
- If CheckBox1.Checked Then
- Begin
- If Not(CheckBox2.Checked) Then
- Begin
- Seek(Input,StreamStart+j);
- If Position-j>32768 Then
- Begin
- For k:=1 To (Position-j) Div 32768 Do
- Begin
- BlockRead(Input,Buffer[1],32768,Temp);
- BlockWrite(Backup,Buffer[1],Temp);
- End;
- BlockRead(Input,Buffer[1],((Position-j) Mod 32768),Temp);
- BlockWrite(Backup,Buffer[1],Temp);
- End
- Else
- Begin
- BlockRead(Input,Buffer[1],Position-j,Temp);
- BlockWrite(Backup,Buffer[1],Temp);
- End;
- End
- Else Difference:=Difference+Position-j;
- End;
- End
- Else
- Begin
- Seek(Input,FilePos(Input)+6);
- ChunkName[0]:=#2;
- BlockRead(Input,ChunkName[1],2);
- Seek(Input,FilePos(Input)-8);
- If (ChunkName='dc') Or (ChunkName='wb') Or (ChunkName='db') Then
- Begin
- ChunkName[0]:=#4;
- ChunkName:='idx1';
- End
- Else
- Begin
- ChunkName[0]:=#4;
- ChunkName:='0000';
- Goto BError;
- End
- End;
- End;
- End;
- Application.ProcessMessages;
- If StopButton Then
- Begin
- Memo1.Lines.Insert(0,' Index rebuilding aborted...');
- ProgressBar1.Position:=0;
- StopButton:=False;
- CloseFile(Input);
- CloseFile(Output);
- If CheckBox1.Checked Then CloseFile(Backup);
- Erase(Output);
- EnableButtons;
- Exit;
- End;
- Until (Eof(Input)) Or (ChunkName='idx1');
- Size:=i*16;
- Seek(Output,4);
- BlockWrite(Output,Size,4);
- If CheckBox1.Checked Then
- Begin
- StreamSize:=Filesize(Backup)-StreamStart;
- Seek(Backup,StreamStart-4);
- BlockWrite(Backup,StreamSize,4);
- Seek(Backup,StreamStart+StreamSize);
- Seek(Output,0);
- Repeat
- BlockRead(Output,Buffer[1],32768,Temp);
- BlockWrite(Backup,Buffer[1],Temp);
- Until Not(Temp=32768);
- Truncate(Backup);
- CloseFile(Input);
- CloseFile(Output);
- CloseFile(Backup);
- Erase(Output);
- End
- Else
- Begin
- StreamSize:=Filesize(Input)-StreamStart;
- Seek(Input,StreamStart-4);
- BlockWrite(Input,StreamSize,4);
- Seek(Input,StreamStart+StreamSize);
- Seek(Output,0);
- Repeat
- BlockRead(Output,Buffer[1],32768,Temp);
- BlockWrite(Input,Buffer[1],Temp);
- Until Not(Temp=32768);
- Truncate(Input);
- CloseFile(Input);
- CloseFile(Output);
- Erase(Output);
- End;
- Memo1.Lines.Insert(0,' Done.');
- EnableButtons;
- end;
-
- procedure TForm1.Button2Click(Sender: TObject);
- begin
- DisableButtons;
- If Maskedit1.Text='' Then
- Begin
- Memo1.Lines.Insert(0,' No file selected.');
- EnableButtons;
- Exit;
- End;
- AssignFile(Input,MaskEdit1.Text);
- {$I-}
- Reset(Input,1);
- {$I+}
- If Not (IOResult=0) Then
- Begin
- If (Temp=3) Or (Temp=2) Then Memo1.Lines.Insert(0,' File not found.')
- Else
- If Temp=5 Then Memo1.Lines.Insert(0,' The file is write-protected.')
- Else Memo1.Lines.Insert(0,' Can not open the file.');
- EnableButtons;
- Exit;
- End;
- Seek(Input,8);
- BlockRead(Input,ChunkName[1],8);
- ChunkName[0]:=#8;
- If ChunkName<>'AVI LIST' Then
- Begin
- Memo1.Lines.Insert(0,' This is not an AVI file.');
- CloseFile(Input);
- EnableButtons;
- Exit;
- End;
- Memo1.Lines.Insert(0,' Stripping index...');
- Position:=16;
- Size:=0;
- Chunkname[0]:=#4;
- Repeat
- Position:=Position+Size;
- Seek(Input,Position);
- BlockRead(Input,Size,4);
- BlockRead(Input,Chunkname[1],4);
- Inc(Position,8);
- Until Chunkname='movi';
- StreamStart:=Position-4;
- StreamSize:=Size;
- Seek(Input,StreamStart+StreamSize);
- If Eof(Input) Then
- Begin
- Memo1.Lines.Insert(0,' Unexpected end of file, index not found.');
- CloseFile(Input);
- EnableButtons;
- Exit;
- End;
- Truncate(Input);
- Seek(Input,StreamStart-4);
- BlockWrite(Input,StreamSize,4);
- CloseFile(Input);
- Memo1.Lines.Insert(0,' Done.');
- EnableButtons;
- end;
-
- procedure TForm1.Button3Click(Sender: TObject);
- Label CError;
- Label CStartRead;
-
- begin
- DisableButtons;
- If MaskEdit1.Text='' Then
- Begin
- Memo1.Lines.Insert(0,' No file selected.');
- EnableButtons;
- Exit;
- End;
- AssignFile(Input,MaskEdit1.Text);
- {$I-}
- Reset(Input,1);
- {$I+}
- Temp:=IOResult;
- If Temp<>0 Then
- Begin
- If (Temp=3) Or (Temp=2) Then Memo1.Lines.Insert(0,' File not found.')
- Else
- If Temp=5 Then Memo1.Lines.Insert(0,' The file is write-protected.')
- Else Memo1.Lines.Insert(0,' Can not open the file.');
- EnableButtons;
- Exit;
- End;
- Seek(Input,8);
- BlockRead(Input,ChunkName[1],8);
- ChunkName[0]:=#8;
- If ChunkName<>'AVI LIST' Then
- Begin
- Memo1.Lines.Insert(0,' This is not an AVI file.');
- CloseFile(Input);
- EnableButtons;
- Exit;
- End;
- Memo1.Lines.Insert(0,' Checking Errors...');
- Memo1.Lines.Insert(0,' NOTE: The error checking is not perfect!');
- Position:=16;
- Size:=0;
- Chunkname[0]:=#4;
- Repeat
- Position:=Position+Size;
- Seek(Input,Position);
- BlockRead(Input,Size,4);
- BlockRead(Input,Chunkname[1],4);
- Inc(Position,8);
- Until Chunkname='movi';
- StreamStart:=Position-4;
- StreamSize:=Size;
- Chunkname:='idx1';
- Position:=4;
- i:=0;
- Frame:=0;
- Interleaved:=False;
- StopButton:=False;
- Repeat
- ProgressBar1.Position:=Position Div (FileSize(Input) Div 100);
- Seek(Input,StreamStart+Position);
- If Not Eof(Input) Then
- Begin
- CStartRead:
- BlockRead(Input,Chunkname[1],4,Temp);
- If ChunkName='LIST' Then
- Begin
- Seek(Input,FilePos(Input)+8);
- Inc(Position,12);
- Goto CStartRead;
- End;
- If ChunkName='JUNK' Then
- Begin
- BlockRead(Input,Size,4);
- Position:=Position+Size+8;
- Seek(Input,StreamStart+Position);
- Goto CStartRead;
- End;
- If (Copy(ChunkName,1,2)='ix') Or (Copy(ChunkName,3,2)='ix') Then
- Begin
- Seek(Input,FilePos(Input)+12);
- Inc(Position,16);
- Seek(Input,StreamStart+Position);
- Interleaved:=True;
- Goto CStartRead;
- End;
- If Not Eof(Input) Then
- Begin
- If ((ChunkName[1] In Number) And (ChunkName[2] In Number)) And
- ((Copy(ChunkName,3,2)='dc') Or (Copy(ChunkName,3,2)='db') Or
- (Copy(ChunkName,3,2)='wb')) Then
- Begin
- Inc(Frame);
- If Interleaved Then
- Begin
- Seek(Input,FilePos(Input)-16);
- Dec(Position,16);
- Interleaved:=False;
- End;
- BlockRead(Input,Size,4,Temp);
- If (Size<0) And (Temp=4) Then
- Begin
- Inc(Position,4);
- Seek(Input,StreamStart+Position);
- BlockRead(Input,Chunkname[1],4);
- If ChunkName='LIST' Then
- Begin
- Seek(Input,FilePos(Input)+8);
- Inc(Position,12);
- Goto CStartRead;
- End;
- If ChunkName='JUNK' Then
- Begin
- BlockRead(Input,Size,4);
- Position:=Position+Size+8;
- Seek(Input,StreamStart+Position);
- Goto CStartRead;
- End;
- Seek(Input,StreamStart+Position);
- Goto CError;
- End;
- If Not Eof(Input) Then
- Begin
- BlockRead(Input,FrameType,1);
- j:=(((Position+Size) Div 2)+((Position+Size) Mod 2))*2+8;
- Seek(Input,StreamStart+j-1);
- If Not Eof(Input) Then
- Begin
- Position:=(((Position+Size) Div 2)+((Position+Size) Mod 2))*2+8;
- Inc(i);
- End;
- End;
- End
- Else
- CError:
- If Chunkname<>'idx1' Then
- Begin
- Str(Frame,Text);
- Text:=' Corrupted data detected at frame '+Text;
- Memo1.Lines.Insert(0,Text);
- Str(StreamStart+Position,Text);
- Text:=' Error offset: '+Text;
- Memo1.Lines.Insert(0,Text);
- Repeat
- Seek(Input,StreamStart+Position);
- If Not Eof(Input) Then
- Begin
- BlockRead(Input,Buffer[1],32768,Temp);
- j:=1;
- Repeat
- If ((Chr(Buffer[j])='d') Or (Chr(Buffer[j])='w')) And (Not Eof(Input)) Then
- Begin
- If ((Chr(Buffer[j+1])='c') Or (Chr(Buffer[j+1])='b')) And (Not Eof(Input)) Then
- Begin
- Seek(Input,StreamStart+Position+j-3);
- If Not Eof(Input) Then BlockRead(Input,ChunkName[1],4);
- End;
- End;
- Inc(j);
- Until (((Copy(ChunkName,3,2)='dc') Or (Copy(ChunkName,3,2)='db') Or
- (Copy(ChunkName,3,2)='wb')) And ((ChunkName[1] In Number) And
- (ChunkName[2] In Number))) Or (Chunkname='idx1') Or (j>32768);
- End;
- Inc(Position,j-3);
- Application.ProcessMessages;
- If StopButton Then
- Begin
- Memo1.Lines.Insert(0,' Error checking aborted...');
- ProgressBar1.Position:=0;
- StopButton:=False;
- CloseFile(Input);
- EnableButtons;
- Exit;
- End;
- Until (((Copy(ChunkName,3,2)='dc') Or (Copy(ChunkName,3,2)='db') Or
- (Copy(ChunkName,3,2)='wb')) And ((ChunkName[1] In Number) And
- (ChunkName[2] In Number))) Or (Chunkname='idx1') Or Eof(Input);
- If Not Eof(Input) Then Dec(Position);
- End
- Else
- Begin
- Seek(Input,FilePos(Input)+6);
- ChunkName[0]:=#2;
- BlockRead(Input,ChunkName[1],2);
- Seek(Input,FilePos(Input)-8);
- If (ChunkName='dc') Or (ChunkName='wb') Or (ChunkName='db') Then
- Begin
- ChunkName[0]:=#4;
- ChunkName:='idx1';
- End
- Else
- Begin
- ChunkName[0]:=#4;
- ChunkName:='0000';
- Goto CError;
- End
- End;
- End;
- End;
- Application.ProcessMessages;
- If StopButton Then
- Begin
- Memo1.Lines.Insert(0,' Error checking aborted...');
- ProgressBar1.Position:=0;
- StopButton:=False;
- CloseFile(Input);
- Exit;
- End;
- Until (Eof(Input)) Or (ChunkName='idx1');
- CloseFile(Input);
- Memo1.Lines.Insert(0,' Done.');
- EnableButtons;
- end;
-
- procedure TForm1.Exit1Click(Sender: TObject);
- begin
- Close;
- end;
-
- procedure TForm1.About1Click(Sender: TObject);
- begin
- Form2.Show;
- end;
-
- procedure TForm1.StayTop(Sender: TObject);
- begin
- If Stayontop1.Checked Then
- Begin
- Stayontop1.Checked:=Not(Stayontop1.Checked);
- SetWindowPos(TForm1(Self).Handle,HWND_NOTOPMOST,0,0,0,0,SWP_NOSIZE+SWP_NOMOVE);
- End
- Else
- Begin
- Stayontop1.Checked:=Not(Stayontop1.Checked);
- SetWindowPos(TForm1(Self).Handle,HWND_TOPMOST,0,0,0,0,SWP_NOSIZE+SWP_NOMOVE);
- End;
- end;
-
- procedure TForm1.FormCreate(Sender: TObject);
- begin
- DropFileTarget1.register(Form1)
- end;
-
- procedure TForm1.FormDestroy(Sender: TObject);
- begin
- DropFiletarget1.Unregister;
- end;
-
- procedure TForm1.DropFileTarget1Drop(Sender: TObject;
- ShiftState: TShiftState; Point: TPoint; var Effect: Integer);
- begin
- MaskEdit1.Text:=DropFileTarget1.files[0];
- end;
-
- procedure TForm1.StopClick(Sender: TObject);
- begin
- StopButton:=True;
- end;
-
- procedure TForm1.CheckBox1Click(Sender: TObject);
- begin
- CheckBox2.Enabled:=Not(CheckBox2.Enabled);
- If Not(CheckBox2.Enabled) Then CheckBox2.Checked:=False;
- end;
-
- end.
-